package com.lanou.zakerproject.hotspot;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.TabHost;

import com.lanou.zakerproject.R;
import com.lanou.zakerproject.base.BaseActivity;
import com.lanou.zakerproject.subscribe.MainActivity;

/**
 * Created by dllo on 16/1/15.
 */
public class HotspotLikeActivity extends BaseActivity {
    private TabHost tabHost;
    private FragmentManager fragmentManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hotspot_like);
        tabHost = (TabHost) findViewById(android.R.id.tabhost);
        tabHost.setup();
        TabHost.TabSpec tab_yourhobby = tabHost.newTabSpec("tab_yourhobby");// 将标签视图添加到view中
        tab_yourhobby.setIndicator("你的偏好");
        tab_yourhobby.setContent(R.id.tab_your_hobby);
        tabHost.addTab(tab_yourhobby);// 将标签添加到TabHost
        TabHost.TabSpec tab_addhobby = tabHost.newTabSpec("tab_yourhobby");// 将标签视图添加到view中
        tab_addhobby.setIndicator("添加你的偏好");
        tab_addhobby.setContent(R.id.tab_add_hobby);
        tabHost.addTab(tab_addhobby);// 将标签添加到TabHost
        fragmentManager = getSupportFragmentManager();//初始化碎片管理器
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();//初始化碎片化业务
        fragmentTransaction.replace(R.id.tab_your_hobby, new HotSpotHobbyFragment());
        fragmentTransaction.replace(R.id.tab_add_hobby, new HotSpotAddHobbyFragment());
        fragmentTransaction.commit();
        findViewById(R.id.hobby_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HotspotLikeActivity.this.finish();
            }
        });
    }
}
